const express = require('express')
const ctrldb = require('../utils/ctrldb')
const getip = require('../utils/getip')
const router = express.Router()

router.get('/mine', (req, res)=>{
    ctrldb('swiper', (data)=>{
        const arr = data.mine.map((item)=>{
            item.img = 'http://'+getip()+':8888/'+item.img
            return item
        })
        res.json(arr)
    })
})

router.get('/home', (req, res)=>{
    ctrldb('swiper', (data)=>{
        const arr = data.home.map((item)=>{
            item.img = 'http://'+getip()+':8888/'+item.img
            return item
        })
        res.json(arr)
    })
})

module.exports = router